<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<script src="js/vue.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div id="app">
			<p>本例变量过滤器：</p>
			<p>简单例子：</p>
			<p>{{message | filter1}}</p>
			
			<p>串联例子(从左到右执行)：</p>
			<p>{{message | filter1 | filter2}}</p>
			
			<p>参数例子(第一个参数是过滤器要操作的对象，所以参数是从第二个开始指定的)：</p>
			<p>{{message | filter3('3', '4')}}</p>
		</div>
	</body>
<script type="text/javascript">
var app = new Vue({
	el: '#app',
	data: {
		message: "这是初始内容"
	},
	
	//filters属性定义过滤器
	filters: {
		filter1: function(val){
			return "{1{" + val + "}1}";
		},
		filter2: function(val){
			return "{2{" + val + "}2}";
		},
		filter3: function(val, sleft, sright){
			return "{" + sleft + "{" + val + "}" + sright + "}";
		}
	}
});
</script>
</html>
